#ifndef __STORMWIDGET_CONFIGMANAGE_CTASK_ITASK_H
#define __STORMWIDGET_CONFIGMANAGE_CTASK_ITASK_H

#include "itask.h"
#include "CommonDefine.h"
#include "DownloadThread.h"
#include "IWinNetEvent.h"
#include "ITaskEvent.h"
#include "PostCount.h"

class CTask :
	public ITask,public IWinNetEvent
{
public:
	CTask();
	virtual ~CTask(void);

	virtual void Run(TASKTYPE nTaskType,ITaskEvent* pNetEvent,CSetupThread* pSetup,CPostCount* pPostCount);
	virtual void Stop();
	virtual void Pause();
	//virtual void Resume();
	virtual TASKSTATE GetState();
	void SetTaskContent(const CMaterialInfo& content);
	CMaterialInfo GetTaskContext();

	void __stdcall OnWinNetError(DWORD dwCode, LPCTSTR lpError);
	void __stdcall OnProgress(long long dwLength, long long dwTotalSize);
	void __stdcall OnDownloadComplete(BOOL bSuccessed);
protected:
	TASKSTATE m_nState;
	CMaterialInfo m_TaskInfomation;
	CDownloadThread* m_pDownloadThread;
	CPostCount* m_pPostCount;
	ITaskEvent* m_pTaskCallBack;
	CSetupThread* m_pNeedSetup;
	TASKTYPE m_nTaskType;
	CStdString m_strSetupPath;
	bool m_bIsPause;

};
#endif //__STORMWIDGET_CONFIGMANAGE_CTASK_ITASK_H
